import { mapActions } from "vuex";

export default {
  props: {
    // 详情页面用到
    uid: {
      type: String,
      default: "",
    },
    flowTaskId: {
      type: String,
      default: "",
    },
    taskCode: {
      type: String,
      default: "",
    },
  },
  computed: {
    // 路由名称
    routeName() {
      return this.$route.name;
    },
    // 是否是配置页面
    isConfigPage() {
      return this.routeName.startsWith("business-process-page");
    },
    // 控制页面配置页面，提交按钮不可点击
    btnDisabled() {
      return !!this.isConfigPage;
    },
  },
  data() {
    return {
      // 提交按钮loading
      btnLoading: false,
      // 页面加载动画
      loading: false,
    };
  },
  methods: {
    ...mapActions("d2admin/page", ["close"]),
    /**
     * 取消
     */
    async doCancel() {
      if (this.isConfigPage) {
        await this.close({ tagName: this.$route.fullPath });
      } else {
        this.$emit("cancel");
      }
    },
  },
};
